<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>返回 openSSL 错误消息</title>
<link media="all" rel="stylesheet" type="text/css" href="styles/03e73060321a0a848018724a6c83de7f-theme-base.css" />
<link media="all" rel="stylesheet" type="text/css" href="styles/03e73060321a0a848018724a6c83de7f-theme-medium.css" />

 </head>
 <body class="docs"><div class="navbar navbar-fixed-top">
  <div class="navbar-inner clearfix">
    <ul class="nav" style="width: 100%">
      <li style="float: left;"><a href="function.openssl-encrypt.html">« openssl_encrypt</a></li>
      <li style="float: right;"><a href="function.openssl-free-key.html">openssl_free_key »</a></li>
    </ul>
  </div>
</div>
<div id="breadcrumbs" class="clearfix">
  <ul class="breadcrumbs-container">
    <li><a href="index.html">PHP Manual</a></li>
    <li><a href="ref.openssl.html">OpenSSL 函数</a></li>
    <li>返回 openSSL 错误消息</li>
  </ul>
</div>
<div id="layout">
  <div id="layout-content"><div id="function.openssl-error-string" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">openssl_error_string</h1>
  <p class="verinfo">(PHP 4 &gt;= 4.0.6, PHP 5, PHP 7, PHP 8)</p><p class="refpurpose"><span class="refname">openssl_error_string</span> &mdash; <span class="dc-title">返回 openSSL 错误消息</span></p>

 </div>
 
 <div class="refsect1 description" id="refsect1-function.openssl-error-string-description">
  <h3 class="title">说明</h3>
  <div class="methodsynopsis dc-description">
   <span class="methodname"><strong>openssl_error_string</strong></span>(): <span class="type">string</span></div>

  <p class="para rdfs-comment">
   <span class="function"><strong>openssl_error_string()</strong></span> 从openSSL库返回最后一个错误。错误消息已被队列化，因此这个函数可以多次调用用来收集所有的信息。最后一个错误将是最近的一个。
  </p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.openssl-error-string-returnvalues">
  <h3 class="title">返回值</h3>
  <p class="para">
   成功，返回错误信息字符串，如果没有任何错误信息则返回 <strong><code>false</code></strong>。
  </p>
 </div>


 <div class="refsect1 examples" id="refsect1-function.openssl-error-string-examples">
  <h3 class="title">范例</h3>
  <p class="para">
   <div class="example" id="example-937">
    <p><strong>示例 #1 <span class="function"><strong>openssl_error_string()</strong></span> example</strong></p>
    <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br /></span><span style="color: #FF8000">//&nbsp;lets&nbsp;assume&nbsp;you&nbsp;just&nbsp;called&nbsp;an&nbsp;openssl&nbsp;function&nbsp;that&nbsp;failed<br /></span><span style="color: #007700">while&nbsp;(</span><span style="color: #0000BB">$msg&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">openssl_error_string</span><span style="color: #007700">())<br />&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;</span><span style="color: #0000BB">$msg&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #DD0000">"&lt;br&nbsp;/&gt;\n"</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</code></div>
    </div>

   </div>
  </p>
 </div>


</div></div></div></body></html>